# 集合
# my_set = {"传智教育", "黑马程序员", 'itheima', '传智教育', '黑马程序员', 'itcast', 'itheima'}
# my_set_empty = set()  # 定义空集合
# print(f"my_set: {my_set}，类型是{type(my_set)}")
#
# # 集合无序，不支持下标索引访问，集合不是序列，但是允许被修改
#
# # 添加元素
# my_set.add("python")
# my_set.add("传智教育")
# print(f"my_set: {my_set}")
#
# my_set = {'ithei', 'itcast', 'heimachengxuyuan'}
# ele = my_set.pop()  # 随机取出
# print(ele)
# print(my_set)
# my_set.clear()
# print(my_set)
#
# # 取两个集合的差集
# set1 = {1, 2, 3, 4, 5, 6, 7, 9}
# set2 = {2, 5, 6, 8}
# # 取交集 set.intersection(s)
# set3 = set1.intersection(set2)
# print("set3 = ", set3)  # set3 =  {2, 5, 6}
# 取差集
# set4 = set1.difference(set2)
# print("set4 = ", set4)  # set4 =  {1, 3, 4, 7, 9}
# 消除差集
# set1改变，set2不改变
# set1.difference_update(set2)
# print("set1 = ", set1)
# print("set2 = ", set2)
#
# set5 = {1, 2, 3, 4, 5, 6, 7, 9}
# set6 = [1, 2, 3, 1, 5, 1, 7, 9]
# print("个数：", set6.count(1))
# for i in set5:
#     print(i, end="\t")


# 信息去重案例
my_list = ['黑马程序员','传智播客','黑马程序员','传智播客',
           'itheima','itcast','itheima','itcast','best']

my_set = set()
for ele in my_list:
    print(ele,end="\t")
    my_set.add(ele)
print()
print(my_set)





